<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>

<%@ page import="org.limp.mine.StringTool"%>
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.Controller"%>
<%@ page import="org.limp.mine.DateTrimmer"%>
<%
	String context = jt.classic.system.ISystem.getContextPath();
	Object[] result = (Object[]) request.getAttribute("result");
	Label label = (Label) result[1];
	Controller controller = (Controller) result[2];
	String pageNO = (String) result[3];
	List resultList = (List) result[0];

	String v_cdh = StringTool
			.checkString(request.getAttribute("v_cdh"));
	String v_ycsjq = StringTool.checkString(request
			.getAttribute("v_ycsjq"));//用车时间起
	String v_ycsjz = StringTool.checkString(request
			.getAttribute("v_ycsjz"));//用车时间止
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>车辆申请单列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<jsp:include page="../../head.jsp"></jsp:include>
<script language="javascript">
  var chk = false;
  function checkall(thizz){
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox"){
        chks[i].checked = !chk;
      }
    }
    
    chk = !chk;
  }
  
  function ete(){
    var rnt = false;
    var ids = "";
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox" && chks[i].checked){
        rnt = true;
        ids += chks[i].value + ",";
      }
    }
    
    if(!rnt){
      alert("请选择要删除的车辆申请单");
    }else if(confirm("确定删除")){
      createHidden("ids",ids.substring(0,ids.length - 1));
      document.form1.action = "<%=context%>/app/clsqd.do?method=delete";
      document.form1.submit();
    }
  }
  
  function handleQuery(){
    document.form1.action = context + "/app/clsqd.do?method=list";
    document.form1.submit();
  }
  
  function handleInsert(){
      var url = context + "/app/clsqd.do?method=neu";
      window.location.href = url;
  }
  
  function handleEdit(id){
      var url = context + "/app/clsqd.do?method=edit&id=" + id;
      window.location.href = url;
  }  
   
  function handleReresh(){
      window.location.href = context + "/app/clsqd.do?method=list&pageNO=<%=pageNO%>";
  }
</script>
<body>
<form name="form1" method="post" action=""><input type="hidden"
	name="pageNO" value="<%=pageNO%>">
<div>
车单号<input type="text" style="width:100px;" class="box3"
			name="v_cdh" value="<%=v_cdh%>"> 用车时间起 <input type="text"
			class="box3" name="v_ycsjq" style="width:100px;" value="<%=v_ycsjq%>"
			onclick="HS_setDate(this)"> 用车时间止 <input type="text"
			class="box3" name="v_ycsjz" style="width:100px;" value="<%=v_ycsjz%>"
			onclick="HS_setDate(this)"> 
			<img src="/app/info/images/search.png" title="查询" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleQuery();"/>查 询
            <img src="/app/info/images/addinfo.png" title="申请用车" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleInsert();"/>新 建
		    <img src="<%=context %>/app/info/images/page_white_delete.png" title="删除" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleDelete();"/>删 除
</div>
<table class="tbl" align="center" width="98%">
    <thead>
	<tr>
		<td class="td1"
			title="全部选择/取消选择" onclick="javascript:checkall();" width="5%"
			align="center">&nbsp;</td>
		<td class="td1"
			width="20%">&nbsp;车单号</td>
		<td class="td1"
			width="20%">&nbsp;用车时间起</td>
		<td class="td1"
			width="20%">&nbsp;用车时间止</td>
		<td class="td1"
			width="20%">&nbsp;目的地</td>
		<td class="td1"
			width="15%">&nbsp;状态</td>
	</tr>
	</thead>
	<%
			if (resultList != null && !resultList.isEmpty()) {

			for (int i = 0; i < resultList.size(); i++) {
				Map info = (Map) resultList.get(i);
				String number = (String) info.get("PAGINATION_NUMBER");

				String clsqd_id = StringTool.checkString(info
				.get("CLSQD_ID"));//车单号
				String clsqd_ycdw = StringTool.checkString(info
				.get("CLSQD_YCDW"));//用车单位
				String clsqd_yxr = StringTool.checkString(info
				.get("CLSQD_YXR"));//用车人
				String clsqd_dh = StringTool.checkString(info
				.get("CLSQD_DH"));//电话
				String clsqd_ycsjq = StringTool.checkString(info
				.get("CLSQD_YCSJQ"));//用车时间起
				String clsqd_ycsjz = StringTool.checkString(info
				.get("CLSQD_YCSJZ"));//用车时间止
				String clsqd_mdd = StringTool.checkString(info
				.get("CLSQD_MDD"));//目的地
				String clsqd_ccsj = StringTool.checkString(info
				.get("CLSQD_CCSJ"));//出车时间
				String clsqd_cls = StringTool.checkString(info
				.get("CLSQD_CLS"));//车辆数
				String clsqd_zt = StringTool.checkString(info
				.get("CLSQD_ZT"));//状态
				String clsqd_tjr = StringTool.checkString(info
				.get("CLSQD_TJR"));//提交人
				String clsqd_bz = StringTool.checkString(info
				.get("CLSQD_BZ"));//备注
	%>
	<tr onMouseOver="javascript:this.bgColor='#ffff99'"
		onmouseout=" javascript:this.bgColor='#ffffff'" bgColor="#ffffff">
		<td  align="center"><input type="checkbox" name="chk"
			value="<%=clsqd_id%>"></td>
		<td>&nbsp;<a
			href="javascript:void(0);" onclick="javascript:handleEdit('<%=clsqd_id%>');"><%=clsqd_id%></a></td>
		<td>&nbsp;<%=clsqd_ycsjq%></td>
		<td>&nbsp;<%=clsqd_ycsjz%></td>
		<td>&nbsp;<%=clsqd_mdd%></td>
		<td>&nbsp;<%=clsqd_zt%></td>
	</tr>
	<%
		}
		}
	%>
</table>
<table width="98%" class="tab-noborder" align="center">
	<tr>
		<td><%=label.displayLabel()%></td>
		<td align="right"><%=label.startLabel()%> <%=label.previousLabel()%>
		<%=label.nextLabel()%> <%=label.endLabel()%> <%=controller.getController().toString()%>
		</td>
	</tr>
</table>
<%=controller.getControlScript(true)%></form>
</body>
</html>
